package Stack;

public class spisok {
	
		public element head = null;
		public void push(element elem){
			if(head == null){
					head = elem;
				}
				else{
					elem.next = head;
					head =  elem;
				}
			}
		public void pop()
	    {
	            if (head!=null)
	            {
	                System.out.println(head.i);
	                head=head.next;   
	            }   
	    }
		public String toString(){
			StringBuffer sb= new StringBuffer();
			sb.append("[");
			element current = head;
			while (current != null){
				sb.append(current.i + " ");
				current = current.next;
			}
			sb.append("]");
			return sb.toString();
		}
	
}
